#include "../source/data.hh"

void print_backup_info(const cloud::backup_info& info)
{
    std::cout << "ishot: " << info.ishot << std::endl;
    std::cout << "fsize: " << info.fsize << std::endl;
    std::cout << "atime: " << info.atime << std::endl;
    std::cout << "mtime: " << info.mtime << std::endl;
    std::cout << "ctime: " << info.ctime << std::endl;
    std::cout << "fpath: " << info.fpath << std::endl;
    std::cout << "bpath: " << info.bpath << std::endl;
    std::cout << "ppath: " << info.ppath << std::endl;
    std::cout << "dlurl: " << info.dlurl << std::endl;
}

void test_info()
{
    // cloud::backup_info bi1("a.txt");
    // cloud::backup_info bi2("b.txt");
    // print_backup_info(*bi1);
    // print_backup_info(*bi2);
}

void test_data()
{
    cloud::data_manager& dm = cloud::data_manager::instance();
    // dm.insert(bi1);
    // dm.insert(bi2);

    std::vector<cloud::backup_info> infos = dm.get_all();

    // for (auto& info: infos)
    // {
    //     print_backup_info(info);
    //     std::cout << "---------------" << std::endl;
    // }

    print_backup_info(*dm.get_by_fpath("a.txt"));
}

#define TEST \
                2

int main()
{
    switch (TEST)
    {
        case 1: test_info(); break;
        case 2: test_data(); break;
        default: break;
    }

    return 0;
}
